package com.yjs.houtai.controller;

import com.yjs.houtai.entity.Member;
import com.yjs.houtai.entity.Message;
import com.yjs.houtai.service.MemberService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@ResponseBody
@Api(tags = "会员")
@RestController
@RequestMapping("/api/super")
public class MemberController {
    @Resource
    private MemberService memberService;

    @ApiOperation(value="增加会员")
    @PostMapping("/add")
    public Message insertSelective(Member member){
        return memberService.insertSelective(member);
    }

    @ApiOperation(value="删除会员")
    @DeleteMapping("/delete")
    public Message deleteByPrimaryKey(int memberId)
    {
        return memberService.deleteByPrimaryKey(memberId);
    }

    @ApiOperation(value="修改会员信息")
    @PutMapping("/update")
    public Message  updateByPrimaryKeySelective(Member member){
        return memberService.updateByPrimaryKeySelective(member);
    }

    @ApiOperation(value = "查询会员信息")
    @GetMapping("/select")
    public Message selectByPrimaryKey(int memberId){
        return memberService.selectByPrimaryKey(memberId);
    }

    @ApiOperation(value="查询所有会员")
    @GetMapping("/select1")
    public Message selectAll(){
        return memberService.selectAll();
    }
}

